package de.fhaugsburg.games.boardgames.scrabble.gui.listeners;

import java.awt.Component;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import de.fhaugsburg.games.boardgames.scrabble.gui.Controller;
import de.fhaugsburg.games.boardgames.scrabble.gui.GLetterPiece;

public class MousePlayListener implements MouseListener, MouseMotionListener {

	private Controller controller;
	
	
	public MousePlayListener(Controller controller) {
		this.controller = controller;
	}
	
	
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	public void mousePressed(MouseEvent e) {
		Component comp = controller.getGUI().findComponentAt(e.getPoint());
		if (comp instanceof GLetterPiece){
			GLetterPiece piece = (GLetterPiece) comp;
			controller.startDragPiece(e, piece);
		}
	}

	public void mouseReleased(MouseEvent e) {
		controller.dropPiece(e);
	}

	public void mouseDragged(MouseEvent e) {
		controller.dragPiece(e.getPoint());
	}

	public void mouseMoved(MouseEvent e) {
		// TODO Auto-generated method stub

	}

}
